home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.09 Sep 90 / TEDemo / TEDemo.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-24  |  4.5 KB  |  157 lines  |  [TEXT/MPS ]

  1.  
  2. class TTEApplication : public TApplication {
  3. public:
  4.     virtual pascal void ITEApplication(OSType itsMainFileType);
  5.     virtual pascal struct TDocument *DoMakeDocument(CmdNumber itsCmdNumber);
  6.     virtual pascal struct TCommand *DoMenuCommand(CmdNumber aCmdNumber);
  7.     virtual pascal void PoseModalDialog();
  8. #ifdef qDebug
  9.     virtual pascal void IdentifySoftware();
  10. #endif
  11. };
  12.  
  13. class TTEDocument;
  14.  
  15. class TPaletteView : public TView {
  16.  
  17. // friend class TTEDocument;
  18.  
  19. public:
  20.     int            fIconSelected;
  21.     virtual pascal void IPaletteView(TTEDocument *itsTEDocument);
  22.     virtual pascal struct TCommand *DoMouseCommand(Point *theMouse,
  23.                                 EventInfo *info, Point *hysteresis);
  24.     pascal void DoHighlightSelection(HLState fromHL, HLState toHL);
  25.     pascal void Draw(Rect *area);
  26. #ifdef qDebug
  27.     virtual pascal void Fields(pascal void (*DoToField) (StringPtr fieldName,
  28.                              Ptr fieldAddr, short fieldType, void *link), void *link);
  29. #endif
  30. };
  31.  
  32.  
  33. class TBox : public TObject {
  34. public:
  35.     Rect    fLocation;
  36.     pascal void IBox(Rect *itsLocation);
  37.     pascal void DrawShape();
  38.     pascal void NeedDiskSpace(long *data);
  39.     pascal void Read(short aRefNum);
  40.     pascal void Write(short aRefNum);
  41. #ifdef qDebug
  42.     virtual pascal void Fields(pascal void (*DoToField) (StringPtr fieldName,
  43.                              Ptr fieldAddr, short fieldType, void *link), void *link);
  44. #endif
  45. };
  46.  
  47.  
  48. class TTextView : public TTEView {
  49.  
  50. // friend class TTEDocument;
  51.  
  52. public:
  53.     TTEDocument    *fTEDocument;
  54.     TPaletteView    *fPaletteView;
  55.     Boolean            fUpdated;
  56.     pascal void ITextView(TTEDocument *itsTEDocument);
  57.     pascal Boolean DoIdle(IdlePhase phase);
  58.     pascal struct TCommand *DoKeyCommand(short ch, 
  59.                                         short aKeyCode, EventInfo *info);
  60.     pascal struct TCommand *DoMenuCommand(CmdNumber aCmdNumber);
  61.     pascal void DoSetupMenus ();
  62.     pascal struct TCommand *DoMouseCommand(Point *theMouse, 
  63.                                     EventInfo *info, Point *hysteresis);
  64.     pascal Boolean DoSetCursor(Point localPoint, RgnHandle cursorRgn);
  65.     pascal void Draw(Rect *area);
  66. #ifdef qDebug
  67.     virtual pascal void Fields(pascal void (*DoToField) (StringPtr fieldName,
  68.                             Ptr fieldAddr, short fieldType, void *link), void *link);
  69. #endif
  70. };
  71.  
  72. class TColorCmd : public TCommand {
  73.  
  74. // friend class TTEDocument;
  75.  
  76. public:
  77.     TTEDocument    *fTEDocument;
  78.     TTextView        *fTextView;
  79.     int                fOldColorCmd, fNewColorCmd;    // menu command numbers
  80.     pascal void IColorCmd(int aCmdNumber, TTEDocument *itsDocument,
  81.                                         TTextView *itsView);
  82.     pascal void DoIt();
  83.     pascal void RedoIt();
  84.     pascal void UndoIt();
  85. #ifdef qDebug
  86.     virtual pascal void Fields(pascal void (*DoToField) (StringPtr fieldName,
  87.                          Ptr fieldAddr, short fieldType, void *link), void *link);
  88. #endif
  89. };
  90.  
  91.  
  92. class TSketcher : public TCommand {
  93.  
  94. // friend class TTEDocument;
  95.  
  96. public:
  97.     TTEDocument     *fTEDocument;
  98.     TTextView        *fTextView;
  99.     TBox            *fBox;            // the object being sketched
  100.     Rect            fBoxLocation;    // size of the Box being sketched
  101.     pascal void ISketcher(TTEDocument *itsDocument, TTextView *itsView);
  102.     pascal struct TCommand *TrackMouse(TrackPhase aTrackPhase,
  103.                             VPoint *anchorPoint, VPoint *previousPoint, 
  104.                             VPoint *nextPoint, Boolean mouseDidMove);
  105.     pascal void DoIt();
  106.     pascal void RedoIt();
  107.     pascal void UndoIt();
  108. #ifdef qDebug
  109.     virtual pascal void Fields(pascal void (*DoToField) (StringPtr fieldName,
  110.                             Ptr fieldAddr, short fieldType, void *link), void *link);
  111. #endif
  112. };
  113.  
  114.  
  115. class TTEDocument : public TDocument {
  116. public:
  117.     TPaletteView    *fPaletteView;
  118.     TTextView        *fTextView;
  119.     Handle            fTextHdl;            // text typed by user
  120.     int                fTextColorCmd;        // menu command number
  121.     TList            *fShapeList;        // list of Shapes to be drawn
  122.     pascal void ITEDocument();
  123.     pascal void AddShape(TBox *aBox); 
  124.     pascal void DeleteShape();
  125.     pascal void DoMakeWindows();
  126.     pascal void DoMakeViews(Boolean forPrinting);
  127.     pascal void DoNeedDiskSpace(long *dataForkBytes, long *rsrcForkBytes);
  128.     pascal void DoRead(short aRefNum, Boolean rsrcExists, Boolean forPrinting);
  129.     pascal void DoWrite(short aRefNum, Boolean makingCopy);
  130.     pascal void ForEachShapeDo(pascal void (*DoToItem)
  131.                 (TObject *item, void *DoToItem_Staticlink),void *DoToItem_Staticlink);
  132.     pascal void Free();
  133.     pascal void SetTextColorCmd(int theColorCmd);
  134.     pascal int  TextColorCmd();
  135. #ifdef qDebug
  136.     virtual pascal void Fields(pascal void (*DoToField) (StringPtr fieldName,
  137.                             Ptr fieldAddr, short fieldType, void *link), void *link);
  138. #endif
  139. };
  140.  
  141.  
  142. // --- global definitions ---
  143.  
  144. typedef pascal void (*DoToObject) (TObject *aObject, void *DoToObject_staticlink);
  145.  
  146. struct CalcDiskSpaceStruct {
  147.     long myDataForkBytes;
  148. };
  149.  
  150. struct DoToRectStruct {
  151.     int myRefNum;
  152. };
  153.  
  154. //
  155. // --- end of declarations ---
  156. //
  157.